<template lang="html">
  <div class="game-list">
    <div class="game-query form-group ly-row-flex flex-start">
      <select class="form-control game-control-select" v-model="status">
        <option value="1">未领</option>
        <option value="2">已领</option>
        <option value="3">已登录</option>
        <option value="4">已审核</option>
        <option value="5">不发</option>
        <option value="6">已到账</option>
        <option value="7">到帐失败</option>
        <option value="8">过期</option>
        <option value="9">imei已经使用过</option>
      </select>
    </div>
    <div class="form-group input-group search-group game-control-search">
      <input type="text" class="form-control" placeholder="请输入电话号码" v-model="phone"
      @keyup.enter="evtGetSearchGameList">
      <span class="input-group-btn">
        <button class="btn btn-primary" type="button" @click="evtGetSearchGameList">搜索</button>
      </span>
    </div>
    <div class="form-group">
      <button class="btn btn-primary" type="button"
        @click="evtLotsizeAudit"
        v-show="+status === 3 && ids.length > 0">
        批量审核
      </button>
      <button class="btn btn-primary" type="button"
        @click="evtLotsizeNoAward"
        v-show="+status === 3 && ids.length > 0">
        批量不发
      </button>
      <button class="btn btn-primary" type="button"
        @click="evtLotsizeNoAward"
        v-show="+status === 7 && ids.length > 0">
        批量重新审核
      </button>
    </div>
    <table class="table table-bordered table-hover">
      <caption>金贝塔小游戏话费管理</caption>
      <thead>
        <tr>
          <th class="col-xs-1">id</th>
          <th class="col-xs-2">手机号</th>
          <th class="col-xs-1">奖励话费</th>
          <th class="col-xs-2">审核时间</th>
          <th class="col-xs-1">状态</th>
          <th class="col-xs-3 text-center">功能</th>
          <th class="col-xs-2" v-show="(+status === 3 || +status === 7) && list.length > 0">
            <label>
              <input type="checkbox" v-model="selectAll"> 全选
            </label>
          </th>
        </tr>
      </thead>
      <tbody>
        <tr v-for="item in list">
          <td class="col-sm-1">{{item.id}}</td>
          <td class="col-sm-2">{{item.phone}}</td>
          <td class="col-sm-1">{{item.award}}</td>
          <td class="col-sm-2">{{item.auditTime | formatMillisecond}}</td>
          <td class="col-sm-1">{{item.status | getStatusTxt}}</td>
          <td class="col-sm-3 text-center">
            <button class="btn btn-sm btn-primary game-btn-query"
              @click="evtNoAward(item.id)"
              v-show="+item.status === 3">
              {{'不发'}}
            </button>
            <button class="btn btn-sm btn-primary game-btn-query"
              @click="evtAuditRecord(item.id)"
              v-show="+item.status === 3"
              :class="{'btn-danger': +item.status === 4}">
              {{+item.status === 4 ? '已审核' : '审核'}}
            </button>
            <button class="btn btn-sm btn-primary game-btn-query"
              @click="evtReAuditRecord(item.id)"
              v-show="+item.status === 7">重新审核</button>
          </td>
          <td class="col-sm-2" v-show="+item.status === 3 || +item.status === 7">
            <label>
              <input type="checkbox" :value="item.id" v-model="ids">
              {{item.id}}
            </label>
          </td>
        </tr>
      </tbody>
    </table>
    <button class="btn btn-default center-block" type="submit" v-show="hasMore" @click="evtGetMoreGameList">加载更多</button>
  </div>
</template>

<script src="./game-list.js"></script>
<style lang="css" src="./game-list.css"></style>
